package com.hyt.it.ogt.ykcj.common.enums.zs;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

/**
 * @program: it-ogt-ykcj
 * @description: 导入数据校验状态
 * @author: Yang HuanKun
 * @create: 2022-07-27 11:47
 **/
@Getter
@AllArgsConstructor
public enum ImportDataVerifyStatus {

    NONE(0L, ""),
    CERTIFICATE_ALREADY_ISSUE(-9002L, "{}证书已颁发，不允许进行更新操作！"),
    CERTIFICATE_NO_ALREADY_ISSUE(-9003L, "{}证书编码已存在，请调整后重新导入！"),
    ;

    private Long code;
    private String desc;

    public static ImportDataVerifyStatus getByCode(Long code) {
        for (ImportDataVerifyStatus importDataVerifyStatus : values()) {
            if (importDataVerifyStatus.getCode().equals(code)) {
                return importDataVerifyStatus;
            }
        }
        return NONE;
    }

    public static ImportDataVerifyStatus getByCodes(List<Integer> codes) {
        for (ImportDataVerifyStatus importDataVerifyStatus : values()) {
            for (Integer code : codes) {
                if (importDataVerifyStatus.getCode().equals(code)) {
                    return importDataVerifyStatus;
                }
            }
        }
        return NONE;
    }
}
